/*  1:   */ package com.rinsi.util;
/*  2:   */ 
/*  3:   */ import java.util.ArrayList;
/*  4:   */ import java.util.HashMap;
/*  5:   */ import java.util.Iterator;
/*  6:   */ import java.util.List;
/*  7:   */ import java.util.Map;
/*  8:   */ import org.apache.commons.jxpath.JXPathContext;
/*  9:   */ 
/* 10:   */ public class ListUtil
/* 11:   */ {
/* 12:   */   public static List<Map<String, Object>> subList(List<Map<String, Object>> list, String cond)
/* 13:   */   {
/* 14:24 */     JXPathContext context = JXPathContext.newContext(list);
/* 15:   */     
/* 16:26 */     List<Map<String, Object>> subList = new ArrayList();
/* 17:   */     
/* 18:28 */     cond = ".[" + cond + "]";
/* 19:   */     
/* 20:   */ 
/* 21:31 */     Iterator<Map<String, Object>> iter = context.iterate(cond);
/* 22:33 */     while (iter.hasNext()) {
/* 23:35 */       subList.add((Map)iter.next());
/* 24:   */     }
/* 25:38 */     return subList;
/* 26:   */   }
/* 27:   */   
/* 28:   */   public static Map<String, Object> listToMap(List<Map<String, Object>> list, String key)
/* 29:   */   {
/* 30:46 */     if (!AssertUtil.isCollectionNotEmpty(list)) {
/* 31:46 */       return null;
/* 32:   */     }
/* 33:48 */     Map<String, Object> rsMap = new HashMap();
/* 34:   */     
/* 35:50 */     int i = 0;
/* 36:50 */     for (int size = list.size(); i < size; i++)
/* 37:   */     {
/* 38:52 */       Map<String, Object> data = (Map)list.get(i);
/* 39:   */       
/* 40:54 */       rsMap.put(MapUtil.getString(data, key), data);
/* 41:   */     }
/* 42:57 */     return rsMap;
/* 43:   */   }
/* 44:   */   
/* 45:   */   public static Map<String, Object> listToMap(List<Map<String, Object>> list, String key, String value)
/* 46:   */   {
/* 47:65 */     if (!AssertUtil.isCollectionNotEmpty(list)) {
/* 48:65 */       return null;
/* 49:   */     }
/* 50:67 */     Map<String, Object> rsMap = new HashMap();
/* 51:   */     
/* 52:69 */     int i = 0;
/* 53:69 */     for (int size = list.size(); i < size; i++)
/* 54:   */     {
/* 55:71 */       Map<String, Object> data = (Map)list.get(i);
/* 56:   */       
/* 57:73 */       rsMap.put(MapUtil.getString(data, key), data.get(key));
/* 58:   */     }
/* 59:76 */     return rsMap;
/* 60:   */   }
/* 61:   */ }


/* Location:           D:\Users\Desktop\shanxi\项目\sxazmis\WEB-INF\classes\
 * Qualified Name:     com.rinsi.util.ListUtil
 * JD-Core Version:    0.7.0.1
 */